<%-- Copyright (C) 2009 WorkSmart Labs, Inc. --%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" import="java.util.*" %>
<%@ page import="com.wsl.HealthChallenge.models.*" %>
<%-- 
    This is a simple JSP template for a test harness used to provide simple
    HTML-based testing for the GetHighScoresController. 
     
    @author artem
--%>

<!DOCTYPE html>
<html lang="en-us"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <%

  String challengeName = (String) request.getAttribute("challengeName");
  ContestType challengeType = (ContestType) request.getAttribute("challengeType");
  String longScoreUnitText = challengeType.displayName;
  String shortScoreUnitText = challengeType.shortDisplayName;

  String numParticipants = (String) request.getAttribute("numParticipants");
  Set<Map.Entry<String, UserStats>> allUsers =
      (Set<Map.Entry<String, UserStats>>) request.getAttribute("allUsers");
  %>
  <title><%=challengeName%> - WALK2.me</title>
  <link rel="stylesheet" type="text/css" href="/static/healthchallenge.css">
  <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="ie.css" />
  <![endif]-->
</head>

<body>
  <div id="topBar"></div>
  <div id="container">
      <div id="leftColumn">
          <a id="logo" href="/static/Health Challenge-view.htm"></a>
      </div>
      <div id="rightColumn" class="dropShadow">
          <div id="contestNavigation">
          </div>

          <div class="featuredArea">
            <h1><%=challengeName%></h1>
          </div>

          <div class="standingsTable">
            <h2>All contest participants (<%=numParticipants%> people)</h2>
            <table cellspacing="0" cellpadding="0">
              <tbody><tr class="headerRow">
                <td>Ranking</td>
                <td>Name</td>
                <td>Total <%=longScoreUnitText%></td>
              </tr>
              <% int rowNum = 0;
                for (Map.Entry<String, UserStats> entry : allUsers) { 
                  rowNum++;
                  if (rowNum % 2 == 0){ %>
                  <tr>    
                <% } else { %>
                  <tr class="everyOtherRow">    
                <% } %>
                <td><%=rowNum%></td>
                <td><%=entry.getValue().getName()%></td>
                <td><%=entry.getValue().getScore()%></td>
                </tr>
              <% } %>
            </tbody>
          </table>
        </div>
      </div>
  </div>
  <div id="footer">
    <p>Copyright 2010 Google Health Challenge</p>
  </div>
</body>
</html>